package com.atguigu.day12.equals01;

import java.util.Objects;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/13 9:41
 * @注释
 */
public class Dog {
    String name;
    int age;

    public Dog(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Dog dog = (Dog) o;
        return age == dog.age && Objects.equals(name, dog.name);
    }

}
